//
//  JDBaseTableViewController.swift
//  JDWeiBo
//
//  Created by apple on 15/6/24.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

class JDBaseTableViewController: UITableViewController,JDVisitorLoginViewDelegate {

    var uerLog = sharedUserAccount != nil
    
    var vi : JDVisitorLoginView?
    
    
//    override func viewDidLoad() {
//        super.viewDidLoad()
//
//           }
    
    
    override func loadView() {
        
//        uerLog = true
        
        print("用户登录\(uerLog)")
        
        uerLog ? super.loadView() : setupVistorView()
        
        
    }
    
    private func setupVistorView() {
        vi = JDVisitorLoginView()
        
        vi?.delegate = self
        
        view = vi!
        
        // 导航栏添加按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "RegisterButtonClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "LoginButtonClick")
        
    }
    
    // 导航栏按钮监听方法
    func RegisterButtonClick() {
//        print("注册~~~")
    }
    
    func LoginButtonClick() {
//        print("登录~~~")
        let vc = JDOAuthTableViewController()
        
        let nav = UINavigationController(rootViewController: vc)
        
        presentViewController(nav, animated: true, completion: nil)
    }
}


